package com.hyjx.framework.common.tree;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 树型结构数据对象
 *
 * @author wjd
 */
public class ZTreeNode implements Serializable, Comparable<ZTreeNode> {
    /**
     * 节点id
     */
    private String id;

    /**
     * 父节点代码
     */
    private String pId;
    /**
     * 节点显示名称
     */
    private String name;
    /**
     * 节点对象的链接地址
     */
    private List<ZTreeNode> children = new ArrayList<ZTreeNode>();
    /**
     * 节点的展开关闭状态
     */
    private boolean open;

    /**
     * 不显示复选框
     */
    private boolean nocheck;

    /**
     * 节点的选中状态
     */
    private boolean isParent = false;

    /**
     * 选中
     */
    private boolean checked = false;

    /**
     * 扩展字段--数据类型
     */
    private String dataType;

    /**
     * 层级码
     */
    private String levelId = "0";

    public String getLevelId() {
        return levelId;
    }

    public void setLevelId(String levelId) {
        this.levelId = levelId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getpId() {
        return pId;
    }

    public void setpId(String pId) {
        this.pId = pId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<ZTreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<ZTreeNode> children) {
        this.children = children;
    }

    public boolean isOpen() {
        return open;
    }

    public void setOpen(boolean open) {
        this.open = open;
    }

    public boolean isNocheck() {
        return nocheck;
    }

    public void setNocheck(boolean nocheck) {
        this.nocheck = nocheck;
    }

    public boolean isParent() {
        return isParent;
    }

    public void setParent(boolean isParent) {
        this.isParent = isParent;
    }

    public String getDataType() {
        return dataType;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    @Override
    public int compareTo(ZTreeNode o) {
        return this.getLevelId().compareTo(o.getLevelId());
    }
}